openapi: 3.0.0
info:
title: AlgaNews
version: '1.0'
description: >-
REST API da plataforma de notícias da AlgaNews.
contact:
email: contato@algaworks.com
name: AlgaWorks
url: 'https://www.algaworks.com'
servers:
- description: Ambiente local de desenvolvimento
url: 'http://localhost:8080'
- description: Ambiente de produção
url: 'https://api.alganews.com.br'
paths:
/users/{userId}:
parameters:
- schema:
type: integer
format: int64
name: userId
in: path
required: true
get:
operationId: getUserById
summary: Busca um usuário por ID
description: Se a requisição for autenticada para um editor, só poderá ter acesso ao recurso do próprio usuário.
Caso a requisição for autenticada para um gerente ou assistente, poderá ter acesso a qualquer recurso de usuário.
tags:
- Users
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UserDetailed'
'404':
$ref: '#/components/responses/NotFound'
put:
operationId: updateUser
summary: Atualiza um usuário
description: Apenas requisições autenticadas para gerentes ou assistentes são válidas.
Assistentes não podem atualizar informações sensíveis de usuários com perfis de nível de acesso maior que os seus.
tags:
- Users
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserInput'
responses:
'200':
description: Usuário atualizado
content:
application/json:
schema:
$ref: '#/components/schemas/UserDetailed'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
/users:
get:
operationId: getUsers
summary: Consulta os usuários
description: Apenas requisições autenticadas para gerentes ou assistentes são válidas.
tags:
- Users
parameters:
- schema:
type: string
example: João
in: query
name: term
description: Termo para consulta nas propriedades de nome, e-mail e CPF
required: false
- schema:
type: string
example: João
in: query
name: name
description: Nome do usuário
required: false
- schema:
type: string
format: email
example: joao.silva@alganews.com
in: query
name: email
description: E-mail do usuário
required: false
- $ref: '#/components/parameters/pageSort'
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/UserSummary'
post:
operationId: createUser
summary: Cria um novo usuário
description: Apenas requisições autenticadas para gerentes ou assistentes são válidas.
Assistentes não podem criar usuários com perfis de nível de acesso maior que os seus.
tags:
- Users
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserInput'
responses:
'201':
description: Usuário criado
content:
application/json:
schema:
$ref: '#/components/schemas/UserDetailed'
'400':
$ref: '#/components/responses/BadRequest'
/users/{userId}/activation:
parameters:
- schema:
type: integer
format: int64
name: userId
in: path
required: true
put:
operationId: activateUser
summary: Ativa um usuário
description: Apenas requisições autenticadas para gerentes ou assistentes são válidas.
Assistentes não podem ativar usuários com perfis de nível de acesso maior que os seus.
tags:
- Users
responses:
'204':
description: Usuário ativado
'404':
$ref: '#/components/responses/NotFound'
delete:
operationId: deactivateUser
summary: Desativa um usuário
description: Apenas requisições autenticadas para gerentes ou assistentes são válidas.
Assistentes não podem desativar usuários com perfis de nível de acesso maior que os seus.
tags:
- Users
responses:
'204':
description: Usuário desativado
'404':
$ref: '#/components/responses/NotFound'
/users/editors/{editorId}:
parameters:
- schema:
type: integer
format: int64
name: editorId
in: path
required: true
get:
operationId: getEditorById
summary: Busca um editor por ID
tags:
- Users
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/EditorDetailed'
'404':
$ref: '#/components/responses/NotFound'
/users/editors:
get:
operationId: getEditors
summary: Consulta os editores
tags:
- Users
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/EditorSummary'
parameters:
- $ref: '#/components/parameters/pageSort'
/posts:
get:
operationId: getPosts
summary: Consulta posts (com paginação)
tags:
- Posts
security: []
parameters:
- schema:
type: integer
format: int64
example: 332
name: editorId
description: ID do editor (usuário) do post
in: query
required: false
- $ref: '#/components/parameters/pageNumber'
- $ref: '#/components/parameters/pageSize'
- $ref: '#/components/parameters/pageSort'
- schema:
type: boolean
example: true
default: false
name: showAll
description: Inclui todos os posts no resultado da consulta (incluindo os despublicados)
in: query
required: false
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PostsPaginated'
post:
operationId: createPost
summary: Cria um novo post
tags:
- Posts
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PostInput'
responses:
'201':
description: Post criado
content:
application/json:
schema:
$ref: '#/components/schemas/PostDetailed'
'400':
$ref: '#/components/responses/BadRequest'
/posts/{postId}:
parameters:
- schema:
type: integer
format: int64
name: postId
in: path
required: true
get:
operationId: getPostById
summary: Busca um post pelo ID
tags:
- Posts
security: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PostDetailed'
put:
operationId: updatePost
summary: Atualiza um post
tags:
- Posts
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PostInput'
responses:
'200':
description: Post alterado
content:
application/json:
schema:
$ref: '#/components/schemas/PostDetailed'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
delete:
operationId: deletePost
summary: Exclui um post
tags:
- Posts
responses:
'204':
description: Post excluído
'404':
$ref: '#/components/responses/NotFound'
/posts/{postId}/publishing:
parameters:
- schema:
type: integer
format: int64
name: postId
in: path
required: true
put:
operationId: publishPost
summary: Publica um post
tags:
- Posts
responses:
'204':
description: Post publicado
'404':
$ref: '#/components/responses/NotFound'
delete:
operationId: unpublishPost
summary: Despublica um post
tags:
- Posts
responses:
'204':
description: Post despublicado
'404':
$ref: '#/components/responses/NotFound'
/payments:
get:
operationId: getPayments
summary: Consultar pagamentos
tags:
- Payroll
parameters:
- schema:
type: integer
format: int64
example: 332
name: payeeId
description: ID do beneficiário (usuário) do pagamento
in: query
required: false
- schema:
type: string
format: email
example: joao.silva@alganews.com
in: query
name: payeeEmail
description: E-mail do beneficiário (usuário) do pagamento
required: false
- schema:
type: string
format: yyyy-mm
example: '2020-11'
name: scheduledToYearMonth
description: Mês/ano do agendamento
in: query
required: false
- $ref: '#/components/parameters/pageNumber'
- $ref: '#/components/parameters/pageSize'
- $ref: '#/components/parameters/pageSort'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentsPaginated'
post:
operationId: createPayment
tags:
- Payroll
summary: 'Cria um novo pagamento'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentInput'
responses:
'201':
description: Pagamento criado
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentDetailed'
'400':
$ref: '#/components/responses/BadRequest'
/payments/bulk-approvals:
put:
operationId: approveBulkPayments
tags:
- Payroll
summary: 'Aprova vários pagamentos'
requestBody:
content:
application/json:
schema:
type: array
items:
type: integer
example: [ 12, 23, 34 ]
responses:
'204':
description: Pagamentos aprovados
'400':
$ref: '#/components/responses/BadRequest'
/payments/previews:
post:
operationId: createPaymentPreview
tags:
- Payroll
summary: 'Cria uma simulação de pagamento'
description: Uma simulação de pagamento não é persistida no sistema
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentPreviewInput'
responses:
'201':
description: Simulação de pagamento criada
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentPreview'
'400':
$ref: '#/components/responses/BadRequest'
/payments/{paymentId}/approval:
parameters:
- schema:
type: integer
format: int64
example: 332
name: paymentId
description: 'ID do pagamento'
in: path
required: true
put:
operationId: approvePayment
summary: 'Aprova/realiza um pagamento'
tags:
- Payroll
responses:
'204':
description: Pagamento aprovado
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
/payments/{paymentId}:
parameters:
- schema:
type: integer
format: int64
example: 332
name: paymentId
description: ID do pagamento
in: path
required: true
get:
operationId: getPayment
summary: 'Busca um pagamento'
tags:
- Payroll
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentDetailed'
'404':
$ref: '#/components/responses/NotFound'
delete:
operationId: deletePayment
summary: 'Remove um pagamento'
description: >
Exclui fisicamente um pagamento.
Caso o pagamento já tenha sido aprovado, não será possível excluí-lo.
tags:
- Payroll
responses:
'204':
description: Pagamento excluído
'404':
$ref: '#/components/responses/NotFound'
/payments/{paymentId}/posts:
parameters:
- schema:
type: integer
format: int64
name: paymentId
in: path
required: true
- $ref: '#/components/parameters/pageSort'
get:
operationId: getPostsByPayment
summary: Consulta os posts de um pagamento
tags:
- Payroll
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/PostWithEarnings'
/cashflow/entries/{entryId}:
parameters:
- schema:
type: integer
format: int64
example: 332
name: entryId
description: ID do lançamento financeiro
in: path
required: true
get:
operationId: getCashFlowEntry
summary: 'Busca um lançamento financeiro'
tags:
- Cash Flow
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/CashFlowEntryDetailed'
'404':
$ref: '#/components/responses/NotFound'
put:
operationId: updateCashFlowEntry
tags:
- Cash Flow
summary: 'Atualiza um lançamento financeiro'
description: >
Não é permitido atualizar um lançamento financeiro gerado pelo sistema.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CashFlowEntryInput'
responses:
'200':
description: Lançamento financeiro atualizado
content:
application/json:
schema:
$ref: '#/components/schemas/CashFlowEntryDetailed'
'400':
$ref: '#/components/responses/BadRequest'
delete:
operationId: deleteCashFlowEntry
summary: 'Remove um lançamento financeiro'
description: >
Exclui fisicamente um lançamento financeiro.
Caso o lançamento informado tenha sido gerado pelo sistema, não será possível excluí-lo.
tags:
- Cash Flow
responses:
'204':
description: Lançamento financeiro excluído
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
/cashflow/entries:
get:
operationId: getCashFlowEntries
summary: Consulta lançamentos financeiros
tags:
- Cash Flow
parameters:
- schema:
type: object
$ref: '#/components/schemas/CashFlowEntryType'
example: 'REVENUE'
name: type
description: Tipo do lançamento financeiro
in: query
required: true
- schema:
type: string
format: yyyy-mm
example: '2020-11'
name: yearMonth
description: Mês/ano dos lançamentos financeiros
in: query
required: true
- $ref: '#/components/parameters/pageSort'
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CashFlowEntrySummary'
post:
operationId: createCashFlowEntry
tags:
- Cash Flow
summary: 'Cria um novo lançamento financeiro'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CashFlowEntryInput'
responses:
'201':
description: Lançamento financeiro criado
content:
application/json:
schema:
$ref: '#/components/schemas/CashFlowEntryDetailed'
'400':
$ref: '#/components/responses/BadRequest'
/cashflow/entries/bulk-removals:
put:
operationId: deleteBulkCashFlowEntries
tags:
- Cash Flow
summary: 'Exclui vários lançamentos financeiros'
requestBody:
content:
application/json:
schema:
type: array
items:
type: integer
example: [ 12, 23, 34 ]
responses:
'204':
description: Lançamentos financeiros excluídos
'400':
$ref: '#/components/responses/BadRequest'
/cashflow/categories/{categoryId}:
parameters:
- schema:
type: integer
format: int64
example: 332
name: categoryId
description: ID da categoria
in: path
required: true
get:
operationId: getCashFlowCategory
summary: 'Busca uma categoria'
tags:
- Cash Flow
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/CashFlowCategoryDetailed'
'404':
$ref: '#/components/responses/NotFound'
put:
operationId: updateCashFlowCategory
tags:
- Cash Flow
summary: 'Atualiza uma categoria'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CashFlowCategoryInput'
responses:
'200':
description: Categoria atualizada
content:
application/json:
schema:
$ref: '#/components/schemas/CashFlowCategoryDetailed'
'400':
$ref: '#/components/responses/BadRequest'
delete:
operationId: deleteCashFlowCategory
summary: 'Remove uma categoria'
description: >
Exclui fisicamente uma categoria.
Caso a categoria possua lançamentos vinculados, não será possível excluí-la.
tags:
- Cash Flow
responses:
'204':
description: Categoria excluída
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
/cashflow/categories:
get:
operationId: getCashFlowCategories
summary: Consulta categorias
tags:
- Cash Flow
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CashFlowCategorySummary'
parameters:
- $ref: '#/components/parameters/pageSort'
post:
operationId: createCashFlowCategory
tags:
- Cash Flow
summary: 'Cria uma nova categoria'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CashFlowCategoryInput'
responses:
'201':
description: Categoria criada
content:
application/json:
schema:
$ref: '#/components/schemas/CashFlowCategoryDetailed'
'400':
$ref: '#/components/responses/BadRequest'
/metrics/monthly-revenues-expenses:
get:
summary: Consulta métricas mensais de Receitas x Despesas
tags:
- Metrics
parameters:
- schema:
type: string
format: yyyy-mm
example: '2020-11'
name: yearMonth
description: Ano para filtro da consulta
in: query
required: true
responses:
'200':
description: OK
content:
'application/json':
schema:
$ref: '#/components/schemas/MonthlyRevenuesExpenses'
'application/vnd.alganews.chartjs+json':
schema:
$ref: '#/components/schemas/MonthlyRevenuesExpensesChartjs'
/metrics/editor/monthly-earnings:
get:
summary: Consulta métricas mensais das suas receitas por mês e a média dos outros editores
tags:
- Metrics
parameters:
- schema:
type: string
format: yyyy-mm
example: '2020-11'
name: yearMonth
description: Ano para filtro da consulta
in: query
required: true
responses:
'200':
description: OK
content:
'application/json':
schema:
$ref: '#/components/schemas/EditorMonthlyEarnings'
/metrics/editor/top3-tags:
get:
summary: Consulta as três tags mais utilizadas pelo usuário.
tags:
- Metrics
responses:
'200':
description: OK
content:
'application/json':
schema:
$ref: '#/components/schemas/EditorTagRatio'
/upload-requests:
post:
operationId: createUploadRequest
summary: Cria uma solicitação de upload de arquivo
tags:
- Files
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UploadRequestInput'
responses:
'200':
description: Solicitação de upload de arquivo criada
content:
application/json:
schema:
$ref: '#/components/schemas/UploadRequest'
'400':
$ref: '#/components/responses/BadRequest'
components:
securitySchemes:
HttpBearer:
type: http
scheme: bearer
bearerFormat: JWT
OAuth2Local:
type: oauth2
flows:
authorizationCode:
authorizationUrl: 'http://localhost:8081/oauth/authorize'
tokenUrl: 'http://localhost:8081/oauth/token'
refreshUrl: 'http://localhost:8081/oauth/token'
password:
tokenUrl: 'http://localhost:8081/oauth/token'
OAuth2Production:
type: oauth2
flows:
authorizationCode:
authorizationUrl: 'https://auth.alganews.com.br/oauth/authorize'
tokenUrl: 'https://auth.alganews.com.br/oauth/token'
refreshUrl: 'https://auth.alganews.com.br/oauth/token'
password:
tokenUrl: 'https://auth.alganews.com.br/oauth/token'
responses:
NotFound:
description: Recurso não encontrado
content:
application/json:
schema:
$ref: '#/components/schemas/Problem'
BadRequest:
description: Requisição inválida
content:
application/json:
schema:
$ref: '#/components/schemas/Problem'
parameters:
pageNumber:
schema:
type: number
format: int32
minimum: 0
default: 0
name: page
description: Número da página para a consulta
in: query
pageSize:
schema:
type: number
format: int32
minimum: 1
example: 10
name: size
description: Quantidade de itens por página
in: query
pageSort:
schema:
type: array
example:
- 'id,desc'
items:
type: string
name: sort
description: Nome da propriedade para ordenação
in: query
schemas:
UserMinimal:
description: 'Usuário muito resumido (mínimo) possui apenas id, nome e avatar.'
required:
- id
- name
- avatarUrls
type: object
properties:
id:
type: integer
format: int64
example: 29
name:
type: string
example: 'Daniel Bonifacio'
avatarUrls:
$ref: '#/components/schemas/ImageUrls'
UserSummary:
description: 'Usuário resumido possui apenas os principais dados.'
type: object
required:
- id
- name
- email
- role
- active
- createdAt
- canBeActivated
- canBeDeactivated
- canSensitiveDataBeUpdated
- avatarUrls
properties:
id:
type: integer
format: int64
example: 29
name:
type: string
example: 'Daniel Bonifacio'
email:
type: string
format: email
example: 'daniel.bonifacio@algaworks.com'
avatarUrls:
$ref: '#/components/schemas/ImageUrls'
role:
$ref: '#/components/schemas/Role'
active:
type: boolean
example: true
createdAt:
type: string
format: date-time
example: '2017-03-04T00:12:45Z'
canBeActivated:
type: boolean
description: Se o usuário autenticado pode ou não ativar este usuário
example: true
canBeDeactivated:
type: boolean
description: Se o usuário autenticado pode ou não desativar este usuário
example: true
canSensitiveDataBeUpdated:
type: boolean
description: Se o usuário autenticado pode ou não alterar dados sensíveis deste usuário
example: true
UserDetailed:
description: 'Usuário detalhado contém todos os dados.'
type: object
required:
- id
- name
- email
- bio
- role
- birthdate
- taxpayerId
- pricePerWord
- active
- createdAt
- bankAccount
- skills
- metrics
- updatedAt
- phone
- location
- createdBy
- updatedBy
- canBeActivated
- canBeDeactivated
- canSensitiveDataBeUpdated
- avatarUrls
properties:
id:
type: integer
format: int64
example: 29
name:
type: string
example: 'Daniel Bonifacio'
email:
type: string
format: email
example: 'daniel.bonifacio@algaworks.com'
avatarUrls:
$ref: '#/components/schemas/ImageUrls'
bio:
type: string
example: 'Gosta de JavaScript.'
role:
$ref: '#/components/schemas/Role'
birthdate:
type: string
format: date
example: '1999-04-01'
phone:
type: string
example: '5527977778888'
taxpayerId:
type: string
format: cpf
example: '03388492288'
pricePerWord:
type: number
example: 0.06
format: double
active:
type: boolean
example: true
createdAt:
type: string
format: date-time
example: '2020-03-04T00:12:45-03:00Z'
bankAccount:
$ref: '#/components/schemas/BankAccount'
location:
$ref: '#/components/schemas/Location'
skills:
type: array
nullable: true
items:
$ref: '#/components/schemas/Skill'
metrics:
$ref: '#/components/schemas/UserMetrics'
updatedAt:
type: string
format: date-time
example: '2020-03-04T00:12:45-03:00Z'
updatedBy:
$ref: '#/components/schemas/UserMinimal'
createdBy:
$ref: '#/components/schemas/UserMinimal'
canBeActivated:
type: boolean
description: Se o usuário autenticado pode ou não ativar este usuário
example: true
canBeDeactivated:
type: boolean
description: Se o usuário autenticado pode ou não desativar este usuário
example: true
canSensitiveDataBeUpdated:
type: boolean
description: Se o usuário autenticado pode ou não alterar dados sensíveis deste usuário
example: true
UserInput:
type: object
required:
- name
- email
- bio
- taxpayerId
- birthdate
- metadata
- bankAccount
- role
- phone
- location
properties:
name:
type: string
example: 'Daniel Bonifacio'
maxLength: 255
email:
type: string
format: email
example: 'daniel.bonifacio@algaworks.com'
maxLength: 255
avatarUrl:
type: string
example: 'http://localhost:4566/6832112f-e994-4f75-8ca0-aa88734241ff.png'
bio:
type: string
example: 'Gosta de JavaScript.'
maxLength: 255
taxpayerId:
type: string
format: cpf
example: '03388492288'
maxLength: 14
phone:
type: string
example: '5527999991111'
maxLength: 20
pricePerWord:
type: number
format: double
example: 0.06
minimum: 0.0
role:
$ref: '#/components/schemas/Role'
birthdate:
type: string
format: date
example: '1999-04-01'
bankAccount:
$ref: '#/components/schemas/BankAccount'
location:
$ref: '#/components/schemas/Location'
skills:
type: array
nullable: true
items:
$ref: '#/components/schemas/Skill'
UserIdInput:
type: object
required:
- id
properties:
id:
type: number
format: int64
example: 28
UserMetrics:
type: object
required:
- weeklyEarnings
- monthlyEarnings
- lifetimeEarnings
- weeklyWords
- monthlyWords
- lifetimeWords
properties:
weeklyEarnings:
type: number
format: float
minimum: 0
example: 1547.34
monthlyEarnings:
type: number
format: float
minimum: 0
example: 9547.24
lifetimeEarnings:
type: number
format: float
minimum: 0
example: 49547.24
weeklyWords:
type: number
format: int32
minimum: 0
example: 3293
monthlyWords:
type: number
format: int32
minimum: 0
example: 14587
lifetimeWords:
type: number
format: int32
minimum: 0
example: 758659
EditorSummary:
description: 'Editor (usuário) resumido possui apenas os principais dados.'
type: object
required:
- id
- name
- createdAt
- avatarUrls
properties:
id:
type: integer
format: int64
example: 29
name:
type: string
example: 'Daniel Bonifacio'
avatarUrls:
$ref: '#/components/schemas/ImageUrls'
createdAt:
type: string
format: date-time
example: '2017-03-04T00:12:45Z'
EditorDetailed:
description: 'Editor (usuário) detalhado contém todos os dados.'
type: object
required:
- id
- name
- bio
- createdAt
- skills
- location
- avatarUrls
properties:
id:
type: integer
format: int64
example: 29
name:
type: string
example: 'Daniel Bonifacio'
avatarUrls:
$ref: '#/components/schemas/ImageUrls'
bio:
type: string
example: 'Gosta de JavaScript.'
createdAt:
type: string
format: date-time
example: '2020-03-04T00:12:45-03:00Z'
location:
$ref: '#/components/schemas/Location'
skills:
type: array
nullable: true
items:
$ref: '#/components/schemas/Skill'
PostSummary:
type: object
required:
- id
- slug
- title
- editor
- createdAt
- updatedAt
- published
- tags
- canBePublished
- canBeUnpublished
- canBeDeleted
- canBeEdited
- imageUrls
properties:
id:
type: integer
format: int64
example: '42'
slug:
type: string
example: 'como-fazer-x-coisas-com-react-js'
title:
type: string
example: 'Como fazer X coisas com React.js'
imageUrls:
$ref: '#/components/schemas/ImageUrls'
editor:
$ref: '#/components/schemas/EditorSummary'
createdAt:
type: string
format: date-time
example: '2020-12-04T00:12:45-03:00'
updatedAt:
type: string
format: date-time
example: '2020-12-05T00:12:45-03:00'
published:
type: boolean
example: true
tags:
type: array
items:
type: string
example: 'JavaScript'
canBePublished:
type: boolean
description: Se o usuário autenticado pode ou não publicar o post
example: true
canBeUnpublished:
type: boolean
description: Se o usuário autenticado pode ou não despublicar o post
example: true
canBeDeleted:
type: boolean
description: Se o usuário autenticado pode ou não remover o post
example: true
canBeEdited:
type: boolean
description: Se o usuário autenticado pode ou não editar o post
example: true
PostDetailed:
type: object
required:
- id
- editor
- slug
- title
- body
- tags
- createdAt
- published
- updatedAt
- updatedBy
- canBePublished
- canBeUnpublished
- canBeDeleted
- canBeEdited
- imageUrls
properties:
id:
type: integer
format: int64
example: 45
editor:
$ref: '#/components/schemas/EditorSummary'
slug:
type: string
example: 'como-fazer-x-coisas-com-react-js'
title:
type: string
example: 'Como fazer X coisas com React.js'
imageUrls:
$ref: '#/components/schemas/ImageUrls'
body:
type: string
description: Corpo do post em formato Markdown
example: >
Olá, hoje eu vou **mostrar** a como fazer X coisas com `react.js`
tags:
type: array
items:
type: string
example: 'JavaScript'
createdAt:
type: string
format: date-time
example: '2017-03-04T00:12:45-03:00'
earnings:
$ref: '#/components/schemas/PostEarnings'
published:
type: boolean
example: true
updatedAt:
type: string
format: date-time
example: '2020-03-04T00:12:45-03:00Z'
updatedBy:
$ref: '#/components/schemas/UserMinimal'
canBePublished:
type: boolean
description: Se o usuário autenticado pode ou não publicar o post
example: true
canBeUnpublished:
type: boolean
description: Se o usuário autenticado pode ou não despublicar o post
example: true
canBeDeleted:
type: boolean
description: Se o usuário autenticado pode ou não remover o post
example: true
canBeEdited:
type: boolean
description: Se o usuário autenticado pode ou não editar o post
example: true
PostWithEarnings:
type: object
required:
- id
- title
- createdAt
- earnings
- published
- imageUrls
properties:
id:
type: integer
format: int64
example: 45
title:
type: string
example: 'Como fazer X coisas com React.js'
imageUrls:
$ref: '#/components/schemas/ImageUrls'
createdAt:
type: string
format: date-time
example: '2017-03-04T00:12:45-03:00'
earnings:
$ref: '#/components/schemas/PostEarnings'
published:
type: boolean
example: true
PostInput:
type: object
required:
- title
- body
- tags
- imageUrl
properties:
title:
type: string
example: 'Como fazer X coisas com React.js'
maxLength: 255
imageUrl:
type: string
example: 'como-fazer-x-coisas-com-react-js-cover.png'
body:
type: string
description: Este campo retornará uma string marcada utilizando markdown
example: >
Olá, hoje eu vou **mostrar** a como fazer X coisas com `react.js`
minLength: 1
tags:
type: array
items:
type: string
example: 'JavaScript'
PostsPaginated:
allOf:
- $ref: '#/components/schemas/Page'
- type: object
properties:
content:
type: array
items:
$ref: '#/components/schemas/PostSummary'
PaymentInput:
type: object
required:
- payee
- accountingPeriod
- scheduledTo
properties:
payee:
type: object
$ref: '#/components/schemas/UserIdInput'
accountingPeriod:
$ref: '#/components/schemas/Period'
bonuses:
type: array
uniqueItems: true
minItems: 0
items:
$ref: '#/components/schemas/Bonus'
scheduledTo:
type: string
format: date
example: '2020-12-02'
PaymentPreviewInput:
type: object
required:
- payee
- accountingPeriod
properties:
payee:
type: object
$ref: '#/components/schemas/UserIdInput'
accountingPeriod:
$ref: '#/components/schemas/Period'
bonuses:
type: array
uniqueItems: true
minItems: 0
items:
$ref: '#/components/schemas/Bonus'
PaymentPreview:
type: object
required:
- accountingPeriod
- payee
- earnings
- grandTotalAmount
- bankAccount
- bonuses
properties:
accountingPeriod:
$ref: '#/components/schemas/Period'
payee:
$ref: '#/components/schemas/UserMinimal'
earnings:
$ref: '#/components/schemas/PaymentEarnings'
bonuses:
type: array
items:
$ref: '#/components/schemas/Bonus'
grandTotalAmount:
type: number
example: 1645.74
bankAccount:
$ref: '#/components/schemas/BankAccount'
PaymentDetailed:
type: object
required:
- id
- accountingPeriod
- payee
- earnings
- grandTotalAmount
- bankAccount
- createdBy
- createdAt
- scheduledTo
- updatedAt
- updatedBy
- approvedAt
- bonuses
- approvedBy
- canBeDeleted
- canBeApproved
properties:
id:
type: integer
format: int64
example: 332
accountingPeriod:
$ref: '#/components/schemas/Period'
payee:
$ref: '#/components/schemas/UserMinimal'
earnings:
$ref: '#/components/schemas/PaymentEarnings'
bonuses:
type: array
items:
$ref: '#/components/schemas/Bonus'
grandTotalAmount:
type: number
example: 1645.74
bankAccount:
$ref: '#/components/schemas/BankAccount'
createdBy:
$ref: '#/components/schemas/UserMinimal'
approvedBy:
$ref: '#/components/schemas/UserMinimal'
createdAt:
type: string
format: date-time
example: '2017-03-04T00:12:45-03:00'
scheduledTo:
type: string
format: date
example: '2020-12-02'
approvedAt:
type: string
format: date-time
example: '2017-03-04T00:12:45-03:00'
updatedAt:
type: string
format: date-time
example: '2020-03-04T00:12:45-03:00Z'
updatedBy:
$ref: '#/components/schemas/UserMinimal'
canBeApproved:
type: boolean
description: Se o usuário autenticado pode ou não aprovar o pagamento
example: true
canBeDeleted:
type: boolean
description: Se o usuário autenticado pode ou não remover o pagamento
PaymentSummary:
type: object
required:
- id
- accountingPeriod
- payee
- grandTotalAmount
- scheduledTo
- approvedAt
- canBeDeleted
- canBeApproved
properties:
id:
type: integer
format: int64
example: 332
grandTotalAmount:
type: number
example: 1938.33
accountingPeriod:
$ref: '#/components/schemas/Period'
payee:
$ref: '#/components/schemas/UserMinimal'
approvedAt:
type: string
format: date-time
example: '2020-12-01T00:12:45-03:00'
scheduledTo:
type: string
format: date
example: '2020-12-02'
canBeApproved:
type: boolean
description: Se o usuário autenticado pode ou não aprovar o pagamento
example: true
canBeDeleted:
type: boolean
description: Se o usuário autenticado pode ou não remover o pagamento
example: true
PaymentsPaginated:
allOf:
- $ref: '#/components/schemas/Page'
- type: object
properties:
content:
type: array
items:
$ref: '#/components/schemas/PaymentSummary'
CashFlowCategoryDetailed:
type: object
required:
- id
- name
- updatedAt
- updatedBy
- type
- createdAt
- createdBy
- canBeDeleted
- totalEntries
properties:
id:
type: integer
format: int64
example: 2
name:
type: string
example: 'Anúncios'
updatedAt:
type: string
format: date-time
example: '2020-03-04T00:12:45-03:00Z'
updatedBy:
$ref: '#/components/schemas/UserMinimal'
type:
$ref: '#/components/schemas/CashFlowEntryType'
createdAt:
type: string
format: date-time
example: '2020-03-04T00:12:45-03:00Z'
createdBy:
$ref: '#/components/schemas/UserMinimal'
totalEntries:
type: number
format: int64
example: 200
canBeDeleted:
type: boolean
example: false
CashFlowCategorySummary:
type: object
required:
- id
- name
- type
- canBeDeleted
- totalEntries
properties:
id:
type: integer
format: int64
example: 2
name:
type: string
example: 'Anúncios'
type:
$ref: '#/components/schemas/CashFlowEntryType'
totalEntries:
type: number
format: int64
example: 200
canBeDeleted:
type: boolean
example: false
CashFlowCategoryMinimal:
type: object
required:
- id
- name
- type
properties:
id:
type: integer
format: int64
example: 2
name:
type: string
example: 'Anúncios'
type:
$ref: '#/components/schemas/CashFlowEntryType'
CashFlowCategoryInput:
type: object
required:
- name
- type
properties:
name:
type: string
example: 'Anúncios'
maxLength: 50
type:
$ref: '#/components/schemas/CashFlowEntryType'
CashFlowCategoryIdInput:
type: object
required:
- id
properties:
id:
type: number
format: int64
example: 23
CashFlowEntryType:
type: string
example: 'REVENUE'
enum:
- 'REVENUE'
- 'EXPENSE'
CashFlowEntrySummary:
type: object
required:
- id
- type
- transactedOn
- amount
- category
- description
- systemGenerated
- canBeDeleted
- canBeEdited
properties:
id:
type: integer
format: int64
example: 332
type:
$ref: '#/components/schemas/CashFlowEntryType'
transactedOn:
type: string
format: date
example: '2020-12-01'
amount:
type: number
example: 3700.0
category:
$ref: '#/components/schemas/CashFlowCategoryMinimal'
description:
type: string
example: 'Anúncio em postagem - Ipiranga'
systemGenerated:
type: boolean
example: false
canBeDeleted:
type: boolean
example: false
canBeEdited:
type: boolean
example: false
CashFlowEntryDetailed:
type: object
required:
- id
- type
- transactedOn
- amount
- category
- description
- systemGenerated
- createdBy
- createdAt
- updatedBy
- updatedAt
- canBeDeleted
- canBeEdited
properties:
id:
type: integer
format: int64
example: 332
type:
$ref: '#/components/schemas/CashFlowEntryType'
transactedOn:
type: string
format: date
example: '2020-12-01'
amount:
type: number
example: 3700.0
category:
$ref: '#/components/schemas/CashFlowCategoryMinimal'
description:
type: string
example: 'Anúncio em postagem - Ipiranga'
systemGenerated:
type: boolean
example: false
createdBy:
$ref: '#/components/schemas/UserMinimal'
createdAt:
type: string
format: date-time
example: '2020-12-30T00:12:45-03:00'
updatedAt:
type: string
format: date-time
example: '2020-03-04T00:12:45-03:00Z'
updatedBy:
$ref: '#/components/schemas/UserMinimal'
canBeDeleted:
type: boolean
example: false
canBeEdited:
type: boolean
example: false
CashFlowEntryInput:
type: object
required:
- type
- transactedOn
- amount
- category
- description
properties:
type:
$ref: '#/components/schemas/CashFlowEntryType'
transactedOn:
type: string
format: date
example: '2020-12-01'
amount:
type: number
example: 3700.0
format: double
minimum: 0.01
category:
type: object
$ref: '#/components/schemas/CashFlowCategoryIdInput'
description:
type: string
example: 'Anúncio em postagem - Ipiranga'
maxLength: 255
MonthlyRevenuesExpensesChartjs:
type: object
required:
- datasets
properties:
datasets:
type: array
items:
type: object
required:
- label
- data
properties:
label:
type: string
enum: ['Receita', 'Despesa']
example: Receita
data:
type: array
items:
type: number
example: [254587, 325478, 451758, 325875, 521745, 452140, 354751, 658430]
labels:
type: array
items:
type: string
example: [Janeiro de 2021, Fevereiro de 2021, Março de 2021, Abril de 2021, Maio de 2021, Junho de 2021, Julho de 2021, Agosto de 2021]
example:
datasets:
- label: 'Receita'
data: [254587, 325478, 451758, 325875, 521745, 452140, 354751, 658430, 702741, 344553, 700343, 1125145]
- label: 'Despesa'
data: [554720, 500000, 450000, 200000, 200000, 200000, 200000, 400000, 100000, 150000, 200000, 700000]
labels: [Janeiro de 2021, Fevereiro de 2021, Março de 2021, Abril de 2021, Maio de 2021, Junho de 2021, Julho de 2021, Agosto de 2021]
MonthlyRevenuesExpenses:
type: array
items:
type: object
required:
- yearMonth
- totalRevenues
- totalExpenses
properties:
yearMonth:
type: string
format: yyyy-mm
example: 2020-01
totalRevenues:
type: number
example: 3243.23
totalExpenses:
type: number
example: 2445.94
EditorMonthlyEarnings:
type: array
items:
type: object
required:
- yearMonth
- totalAmount
- totalPlatformAverageAmount
properties:
yearMonth:
type: string
format: yyyy-mm
example: 2020-01
totalAmount:
type: number
example: 3243.23
totalPlatformAverageAmount:
type: number
example: 2445.94
EditorTagRatio:
type: array
items:
type: object
required:
- tagName
- percentage
properties:
tagName:
type: string
example: 'Javascript'
percentage:
type: number
example: 50.20
ImageUrls:
type: object
required:
- default
- small
- medium
- large
properties:
default:
type: string
format: uri
example: 'https://storage.googleapis.com/alganews-files/posts/avatar-joao.jpeg'
small:
type: string
format: uri
example: 'https://storage.googleapis.com/alganews-files/posts/avatar-joao-small.jpeg'
medium:
type: string
format: uri
example: 'https://storage.googleapis.com/alganews-files/posts/avatar-joao-medium.jpeg'
large:
type: string
format: uri
example: 'https://storage.googleapis.com/alganews-files/posts/avatar-joao-large.jpeg'
Bonus:
type: object
required:
- title
- amount
properties:
title:
type: string
maxLength: 50
example: '1kk views em 1 dia'
amount:
type: number
example: 1500
format: double
minimum: 0.01
Location:
type: object
required:
- country
- state
- city
properties:
country:
type: string
example: 'Brasil'
maxLength: 50
state:
type: string
example: 'Espírito Santo'
maxLength: 50
city:
type: string
example: 'Vila Velha'
maxLength: 255
Skill:
type: object
required:
- name
- percentage
properties:
name:
type: string
example: 'JavaScript'
maxLength: 50
percentage:
type: number
example: 95
minimum: 0
maximum: 100
BankAccount:
type: object
required:
- bankCode
- agency
- number
- digit
- type
properties:
bankCode:
type: string
example: '001'
minLength: 3
maxLength: 3
agency:
type: string
example: '0001'
minLength: 1
maxLength: 10
number:
type: string
example: '254856'
minLength: 1
maxLength: 20
digit:
type: string
example: '5'
minLength: 1
maxLength: 1
type:
type: string
enum:
- 'SAVING'
- 'CHECKING'
description: >
Tipos de contas:
* `SAVING` - Conta poupança
* `CHECKING` - Conta corrente
Role:
type: string
example: 'EDITOR'
enum:
- 'EDITOR'
- 'ASSISTANT'
- 'MANAGER'
description: >
Tipos de perfis:
* `EDITOR` - Editor de conteúdo
* `ASSISTANT` - Auxiliar de recursos humanos e administração
* `MANAGER` - Gerente da plataforma
PostEarnings:
type: object
required:
- pricePerWord
- words
- totalAmount
properties:
pricePerWord:
type: number
example: 0.06
format: double
words:
type: integer
example: 2429
totalAmount:
type: number
example: 145.74
PaymentEarnings:
type: object
required:
- words
- totalAmount
properties:
words:
type: integer
example: 2429
totalAmount:
type: number
example: 145.74
Period:
type: object
required:
- startsOn
- endsOn
properties:
startsOn:
type: string
format: date
example: '2020-11-01'
endsOn:
type: string
format: date
example: '2020-11-31'
UploadRequestInput:
type: object
required:
- fileName
- contentLength
properties:
fileName:
type: string
example: 6832112f-e994-4f75-8ca0-aa88734241ff.png
contentLength:
type: integer
example: 1000000
UploadRequest:
type: object
required:
- uploadSignedUrl
properties:
uploadSignedUrl:
type: string
format: uri
example: https://storage.googleapis.com/alganews-tmp/tmp/foto.png?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=834856092418-compute%40developer.gserviceaccount.com%2F20210301%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20210301T155344Z&X-Goog-Expires=900&X-Goog-SignedHeaders=content-length%3Bcontent-type%3Bhost&X-Goog-Signature=0864c1ce28319c7b4cb830bb5d57be86d6292bb073fe7f4b2882b7754d6657f8c9b7cae69fb0bc0010e634d4e8ea65e092839a18971513495512044aefbb61437e09714626f59444acbce1e222f0f7a1a7b2d375c40036599d4ae28ee5fa881f1e72603007f560cbcf11295b8522fdb217a7564333e6623f8d23406f1446cbd0db5587fc0a9da8f00c23b18eeaa31bd24204f1d051d735a4b6f819f8d703eabffab8ce6f6676c31cd884fd6f3a530b4aef2f2cc8c7c74fde56fae049d203f6b318fbdd94fe326a11e0152fcce2a016eea9e7cef15720f8333320aed719fa8277c56a5c1ae79f7e2e483da39acf14e5775938263341c3c4e8df6148ccbd0fd474
Page:
type: object
required:
- page
- size
- totalPages
- totalElements
- content
properties:
page:
type: integer
format: int32
example: 2
size:
type: number
format: int32
example: 9
totalPages:
type: integer
format: int32
example: 15
totalElements:
type: number
format: int32
example: 442
ProblemObject:
type: object
required:
- type
- userMessage
properties:
name:
type: string
example: amount
userMessage:
type: string
example: O valor é obrigatório
title: ProblemObject
Problem:
title: Problem
type: object
required:
- status
- timestamp
- type
- title
- detail
description: >
Representa um problema na comunicação com a API.
Este modelo de representação é baseado na RFC 7807 (Problem Details for HTTP APIs)
properties:
status:
type: integer
format: int32
example: 400
timestamp:
type: string
format: date-time
example: '2020-12-01T18:09:02Z'
type:
type: string
example: 'https://alganews.com.br/dados-invalidos'
title:
type: string
example: Dados inválidos
detail:
type: string
example: Um ou mais campos estão inválidos. Faça o preenchimento correto e tente novamente.
# userMessage:
# type: string
# example: Um ou mais campos estão inválidos. Faça o preenchimento correto e tente novamente.
objects:
type: array
description: Lista de objetos ou campos que geraram o erro (opcional)
items:
$ref: '#/components/schemas/ProblemObject'
security:
- HttpBearer: []
- OAuth2Local: []
- OAuth2Production: []
tags:
- name: Users
description: Usuários
- name: Posts
description: Posts
- name: Payroll
description: Folha de pagamentos
- name: Cash Flow
description: Fluxo de caixa
- name: Metrics
description: Métricas
- name: Files
description: Arquivos